<template>
  <div>
    <el-dialog
      title="请选择"
      :append-to-body="true"
      @close="closeDio"
      :visible="dialogTableVisible"
      width="800px"
      style="padding:20px"
    >
      <ul class="cate_product">
        <li
          v-for="(item,i) in list"
          :key="i"
          @click="add_cj(item)"
          v-show="item.show"
        >{{item.url_title}}</li>
      </ul>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "xz_search",
  props: {
    show: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      list: [
        {
          url_title: "商品搜索",
          url: "/shop/shopsearch",
          show: true
        },
        {
          url_title: "新闻搜索",
          url: "/news/search",
          show: true
        },
        {
          url_title: "分类信息搜索",
          url: "/cityinfo/catelist",
          show:
            this.$store.state.plugin.rwds &&
            this.$store.state.plugin.rwds.is_open == 1
        },
        {
          url_title: "直播搜索",
          url: "/live/search",
          show:
            this.$store.state.plugin.zbcj &&
            this.$store.state.plugin.zbcj.is_open == 1
        },
        {
          url_title: "内容付费搜索",
          url: "/page/lesson/search",
          show:
            this.$store.state.plugin.nyffxt &&
            this.$store.state.plugin.nyffxt.is_open == 1
        },
        {
          url_title: "酒店搜索",
          url: "/hotel/search",
          show:
            this.$store.state.plugin.hotel &&
            this.$store.state.plugin.hotel.is_open == 1
        },
        {
          url_title: "酒店积分兑换搜索",
          url: "/hotel/integral",
          show:
            this.$store.state.plugin.hotel &&
            this.$store.state.plugin.hotel.is_open == 1 &&
            this.$store.state.plugin.jfyx &&
            this.$store.state.plugin.jfyx.is_open == 1
        }
      ],
      dialogTableVisible: this.show
    };
  },
  created() {},
  methods: {
    closeDio() {
      this.$emit("isshow", false);
      this.dialogTableVisible = false;
    },
    add_cj(row) {
      this.$emit("sendShop", row);
      this.closeDio();
    }
  },
  watch: {
    show(val1, val2) {
      if (val1 == val2) {
        return;
      }
      this.dialogTableVisible = val1;
    },
    dialogTableVisible(val1, val2) {
      if (val1 == val2) {
        return;
      }
      this.$emit("isshow", val1);
    }
  }
};
</script>

<style  lang="less"  scoped>
.cate_product {
  display: flex;
  flex-wrap: wrap;
  > li {
    width: 25%;
    height: 30px;
    line-height: 30px;
    cursor: pointer;
  }
  li:hover {
    color: red;
  }
}
</style>